package com.china08.yxyapi.entity.es;

import java.util.List;

import org.apache.commons.lang3.StringUtils;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;

import com.china08.yxyapi.entity.ElasticBaseEntity;
import com.china08.yxyapi.model.questionbank.YxyQuesBanQuestType1_2_3Model;
import com.china08.yxyapi.model.questionbank.YxyQuesBanQuestType28Model;
import com.china08.yxyapi.model.questionbank.YxyQuesBanQuestType4_5_6_25_36Model;
import com.china08.yxyapi.model.questionbank.YxyQuesBankModel;
import com.google.gson.Gson;

@Document(indexName = "yxy_question_bank", type = "question")
public class ElasticYxyQuestionBankResource extends ElasticBaseEntity {
    // private static final Logger LOGGER =
    // LoggerFactory.getLogger(ElasticYxyYxyQuesResource.class);

    private static final long serialVersionUID = 1L;

    @Field
    private String stage;

    @Field
    private String stageName;

    @Field
    private String subject;

    @Field
    private String subjectName;

    @Field
    private String difficultyLevel;

    @Field
    private Float difficultyXishu;

    @Field
    private String quesType;

    @Field
    private String examType;

    @Field
    private Integer knowNum;

    @Field
    private String gradeId;

    @Field
    private String source;

    @Field
    private List<String> knowIds;

    @Field
    private String quesBody;

    /**
     * 是否删除
     */
    @Field
    private Integer isDelete = 0;

    static Gson gson = new Gson();

    private Object ques;

    public Object getQues() {
        if (StringUtils.equals("1", quesType) || StringUtils.equals("2", quesType)
                || StringUtils.equals("3", quesType)) {
            ques = gson.fromJson(quesBody, YxyQuesBanQuestType1_2_3Model.class);
        } else if (StringUtils.equals("4", quesType) || StringUtils.equals("5", quesType)
                || StringUtils.equals("6", quesType) || StringUtils.equals("25", quesType)
                || StringUtils.equals("36", quesType)) {
            ques = gson.fromJson(quesBody, YxyQuesBanQuestType4_5_6_25_36Model.class);
        } else if (StringUtils.equals("28", quesType)) {
            ques = gson.fromJson(quesBody, YxyQuesBanQuestType28Model.class);
        } else {
            YxyQuesBankModel bankModel = new YxyQuesBankModel();
            ques = bankModel;
        }
        return ques;
    }

    public String getStage() {
        return stage;
    }

    public void setStage(String stage) {
        this.stage = stage;
    }

    public String getSubject() {
        return subject;
    }

    public void setSubject(String subject) {
        this.subject = subject;
    }

    public String getSubjectName() {
        return subjectName;
    }

    public void setSubjectName(String subjectName) {
        this.subjectName = subjectName;
    }

    public String getDifficultyLevel() {
        return difficultyLevel;
    }

    public void setDifficultyLevel(String difficultyLevel) {
        this.difficultyLevel = difficultyLevel;
    }

    public Float getDifficultyXishu() {
        return difficultyXishu;
    }

    public void setDifficultyXishu(Float difficultyXishu) {
        this.difficultyXishu = difficultyXishu;
    }

    public String getQuesType() {
        return quesType;
    }

    public void setQuesType(String quesType) {
        this.quesType = quesType;
    }

    public String getExamType() {
        return examType;
    }

    public void setExamType(String examType) {
        this.examType = examType;
    }

    public Integer getKnowNum() {
        return knowNum;
    }

    public void setKnowNum(Integer knowNum) {
        this.knowNum = knowNum;
    }

    public String getGradeId() {
        return gradeId;
    }

    public void setGradeId(String gradeId) {
        this.gradeId = gradeId;
    }

    public String getSource() {
        return source;
    }

    public void setSource(String source) {
        this.source = source;
    }

    public List<String> getKnowIds() {
        return knowIds;
    }

    public void setKnowIds(List<String> knowIds) {
        this.knowIds = knowIds;
    }

    public String getQuesBody() {
        return quesBody;
    }

    public void setQuesBody(String quesBody) {
        this.quesBody = quesBody;
    }

    public String getStageName() {
        return stageName;
    }

    public void setStageName(String stageName) {
        this.stageName = stageName;
    }

    public Integer getIsDelete() {
        return isDelete;
    }

    public void setIsDelete(Integer isDelete) {
        this.isDelete = isDelete;
    }

}
